#include <stdio.h>



int main()
{
	char a,b,c;
	int card1 = 0, card2 = 0, card3 = 0;
	int sum;
	printf("请输入牌的数字");
	scanf("%c %c %c",&a,&b,&c);

	card(&card1, &card2, &card3, &a, &b, &c, &sum);



	return 0;

	 
}

void card(int* card1, int* card2, int* card3, char* a, char* b, char* c, int* sum){
	if(*a=='J' || *a=='Q' || *a=='K')
	{
		*card1 = 10;	
	}
	else if(*a != 'A')
	{
		*card1 = *a-'0' ;
	}
	if(*b=='J' || *b=='Q' || *b=='K')
	{
		*card2 = 10;
	}
    else if(*b != 'A')
    {
    	*card2 = *b-'0';
	}
		if(*c=='J' || *c=='Q' || *c=='K')
	{
		*card3=10;
	}
	else if(*c != 'A')
	{
		*card3=*c-'0';
	}
	*sum=*card1+*card2+*card3;
	if(*a=='A')
	{
	if(*sum + 11 > 21)
     	*card1=1;  
	else 
	    *card1=11;
	}
	*sum=*card1+*card2+*card3;
	if(*b=='A')
	{
	if(*sum + 11 > 21)
     	*card2=1;  
	else 
	    *card2=11;
	}
	*sum=*card1+*card2+*card3;
	if(*c=='A')
	{
	if(*sum + 11 > 21)
     	*card3=1;  
	else 
	    *card3=11;
	}
	*sum=*card1+*card2+*card3;
	
	printf("%d",*sum);
}